package com.xnew.manager.elevator.detailRules.service.impl;

import com.github.pagehelper.PageHelper;
import com.xnew.manager.elevator.detailRules.entity.DetailRules;
import com.xnew.manager.elevator.detailRules.mapper.DetailRulesMapper;
import com.xnew.manager.elevator.detailRules.service.DetailRulesService;
import com.xnew.utils.DataInput;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @author PuWeiHeng
 * @create 2022-10-25 15:16
 */
@Service
public class DetailRulesServiceImpl implements DetailRulesService {

    private final Logger logger = LoggerFactory.getLogger(this.getClass());

    @Resource
    private DetailRulesMapper detailRulesMapper;



    /**
     * @description: 查询集合列表
     * @author: PuWeiHeng
     * @date: 2022/10/25 16:09
     * @param:
     * @return:
    */
    @Override
    public Map<String,Object> pageList(int offset, int pagesize) {
        List<DetailRules> pageList = detailRulesMapper.pageList(offset, pagesize);
        int totalCount = detailRulesMapper.pageListCount(offset, pagesize);

        Map<String, Object> result = new HashMap<String, Object>();
        result.put("pageList", pageList);
        result.put("totalCount", totalCount);

        return result;
    }



    /**
     * @description: 维保细则集合
     * @author: PuWeiHeng
     * @date: 2022/10/25 16:27
     * @param:
     * @return:
    */
    @Override
    public List<DetailRules> queryDetailRuleList(DataInput dataInput) {
        PageHelper.startPage(dataInput.getPageNum(),dataInput.getPageSize());
        List<DetailRules> list = detailRulesMapper.queryDetailRuleList(dataInput);
        return list;
    }
}
